import { request, METHOD } from '@/utils/request';
import qs from 'qs';
// 获取所有飞机监控信息
export const getFtmAirlineMonitorInfoApi = (params) => {
  return request('/ftm/ftmAirplane/monitor/info', METHOD.POST, params);
};

// search
// 获取航空公司列表
export const getFtmAirlineApi = () => {
  return request('/ftm/ftmAirline/list', METHOD.GET);
};

// 事件node
export const getEventListAllApi = () => {
  return request('/ftm/ftmEvent/getEventListAll', METHOD.GET);
};

// 获取机型列表
export const getFtmPlaneModelApi = (params) => {
  return request(`/ftm/ftmPlaneModel/listAll?${qs.stringify(params, { arrayFormat: 'repeat' })}`, METHOD.GET);
};

// 获取机队列表
export const getFtmFleetApi = (params) => {
  return request(`/ftm/ftmFleet/listAll?${qs.stringify(params, { arrayFormat: 'repeat' })}`, METHOD.GET);
};

// 获取汇总项目
export const getSummaryItemsApi = () => {
  return request('/serv/ServServiceSummary/findAll', METHOD.POST);
};

// 获取ATA列表
export const getAtaListListApi = () => {
  return request('/ftm/ftmAta/getAtaListAll', METHOD.GET);
};

// 获取起飞 dep/到达arr列表
export const getFtmAirportListApi = (params) => {
  return request('ftm/ftmAirport/listAll', METHOD.GET, params);
};
// 修改机场备注
export const modifyAirportRemarkApi = (params) => {
  return request('/ftm/ftmAirport/modifyAirportRemark', METHOD.POST, params);
};

// 获取机号列表
export const getFtmAirplaneListApi = (params) => {
  return request(`/ftm/ftmAirplane/list?${qs.stringify(params, { arrayFormat: 'repeat' })}`, METHOD.GET);
};

// 获取航段详情
export const getFlightLegDetailApi = (params) => {
  return request('/ftm/ftmFlightLeg/getFlightLegDetail', METHOD.GET, params);
};

// 获取报文类型列表
export const getRepReportTypeApi = () => {
  return request('/rep/repReportCategory/getList', METHOD.GET);
};

// 获取报告类型
export const getTemplateNameApi = () => {
  return request('/rep/repReportTemplate/getTemplateName', METHOD.GET);
};

// 获取报文列表
export const getRepReportApi = (params) => {
  return request('/rep/repReport/getListByLegId', METHOD.POST, params);
};

// 获取最近历史航段信息
export const getFlightLegHistoryListApi = (params) => {
  return request('/ftm/ftmFlightLeg/getFlightLegHistoryList', METHOD.GET, params);
};

// 航段故障信息
export const getEventByLegIdApi = (params) => {
  return request('/ftm/ftmEventLeg/getEventByLegId', METHOD.GET, params);
};

// 获取EF或Fault Summary报文列表
export const getEventListByReportTypeLegIdApi = (params) => {
  return request('/ftm/ftmEventLeg/getEventListByReportTypeLegId', METHOD.GET, params);
};
// 获取航段事件详细信息
export const getEventDetailApi = (params) => {
  return request('/ftm/ftmFlightLeg/getEventDetail', METHOD.GET, params);
};

// 机场信息
export const getAirportDetailApi = (params) => {
  return request('/ftm/ftmAirport/getAirportDetail', METHOD.GET, params);
};

// 获取Snapshot Report列表
export const getListSnapshotByParamApi = (params) => {
  return request('/rep/repReport/getListSnapshotByParam?' + qs.stringify(params, { arrayFormat: 'repeat' }), METHOD.GET);
};

// 获取标签分组列表 下拉框
export const getListByModelApi = (params) => {
  return request('/rep/repReportParamGroup/getListAll', METHOD.GET);
};

// 获取报文列表
export const getRepUplinkMessageListApi = (params) => {
  return request('/rep/repUplinkMessage/getRepUplinkMessageList', METHOD.GET, params);
};

// 上传报文provider的下拉列表
export const repUplinkDestinationApi = (params) => {
  return request('/rep/repUplinkDestination/getList', METHOD.GET, params);
};

// 上传报文UplinkRequest的下拉列表
export const repUplinkRequestApi = (params) => {
  return request('/rep/repUplinkRequest/getList', METHOD.GET, params);
};

// 上传报文
export const addRepUplinkMessageApi = (params) => {
  return request('/rep/repUplinkMessage/addRepUplinkMessage', METHOD.POST, params);
};

// 研究任务
export const getEventItemProcessingApi = (params) => {
  return request('/ftm/ftmEventLeg/getEventItemProcessing', METHOD.POST, params);
};

// 获取故障代码列表
export const getCodeListApi = (params) => {
  return request('/ftm/ftmEventDetail/getListByFaultType', METHOD.GET, params);
};

/**
 * ========================================================
 * ************   收报地址   ************
 * ========================================================
 */

// 获取报文目的地列表
export const getRepUplinkDestinationApi = () => {
  return request('/rep/repUplinkDestination/getList', METHOD.GET);
};

// 新增报文目的地
export const addRepUplinkDestinationApi = (params) => {
  return request('/rep/repUplinkDestination/addRepUplinkDestination', METHOD.POST, params);
};

// 删除报文目的地
export const deleteRepUplinkDestinationApi = (id) => {
  return request(`/rep/repUplinkDestination/delete/${id}`, METHOD.DELETE);
};
// 删除报文目的地 批量
export const deleteBatchListApi = (params) => {
  return request('/rep/repUplinkDestination/batchDelete', METHOD.POST, params);
};

// 修改报文目的地
export const updateRepUplinkDestinationApi = (params) => {
  return request('/rep/repUplinkDestination/update', METHOD.POST, params);
};

// 修改报文目的地 批量
export const updateBatchListApi = (params) => {
  return request('/rep/repUplinkDestination/batchUpdate', METHOD.POST, params);
};

// 报文格式
export const repAnalysisJsonApi = (params) => {
  return request('/rep/repReportTemplate/analysisJson', METHOD.POST, params);
};

// 报文格式Fault
export const getFormattedMessageApi = (params) => {
  return request('/ftm/ftmEventLeg/getFormattedMessage', METHOD.GET, params);
};



// ______________________________________________
// 获取飞机日
export const getQueryFlugTagApi = () => {
  return request('/ftm/flugTag/queryFlugTag', METHOD.GET);
};

// 添加状态数据
export const addStatusDataApi = (params) => {
  return request('/ftm/event/deal/saveData', METHOD.POST, params);
};

// 查询事件状态

export const getEventsStatusApi = () => {
  return request('/ftm/ftmType/queryStatus', METHOD.GET);
};

// 查询事件管控状态

export const getEventsStatusDetailApi = (params) => {
  return request('/ftm/event/deal/queryDealDetail?eventId=' + params, METHOD.GET);
};

// 查询benefit和  action taken

export const getBenefitAndtakenApi = (params) => {
  return request('/ftm/eventInMa/queryImform?type=' + params, METHOD.GET);
};

// 上传文件

export const myuploadApi = (params) => {
  return request('/toolapi/uploadfiles', METHOD.POST, params);
};